// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

package com.nnee.p_pr.p_activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.provider.SearchRecentSuggestions;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.AutoCompleteTextView;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.nnee.p_fk.cls_ActivityEx;
import com.nnee.p_pr.p_activity.p_a.cls_ad;
import com.nnee.p_pr.p_atom.cls_b;
import com.nnee.p_pr.p_atom.cls_u;
import com.nnee.p_pr.p_prot.cls_d;
import com.nnee.p_pr.cls_v;
import java.util.LinkedList;
import java.util.Stack;

// Referenced classes of package com.nnee.p_pr.p_activity:
//            gb, ga, fz, fy, 
//            fx

public class cls_SearchActivity extends cls_ActivityEx
{

    public cls_SearchActivity()
    {
        h = false;
        i = null;
        j = 0;
        l = "/source/search.atom?page=1&len=10&query={searchTerms}";
        m = null;
        n = null;
        o = null;
        q = null;
        r = null;
        s = null;
        t = null;
        u = null;
        v = null;
        x = null;
        y = null;
        z = null;
        E = new gb(this);
        e = new ga(this);
        F = new fz(this);
        f = new fy(this);
        g = new fx(this);
    }

    static ImageView a(SearchActivity searchactivity)
    {
        return searchactivity.C;
    }

    private void a(int i1, cls_u u1, String s1, String s2)
    {
        i1;
        JVM INSTR lookupswitch 5: default 52
    //                   302: 124
    //                   303: 138
    //                   304: 110
    //                   1100: 53
    //                   1105: 91;
           goto _L1 _L2 _L3 _L4 _L5 _L6
_L3:
        break MISSING_BLOCK_LABEL_138;
_L1:
        return;
_L5:
        j = com.nnee.p_pr.cls_v.a().d(s1, s2, b.a);
_L7:
        p.add(new Integer(j));
        if(true) goto _L1; else goto _L6
_L6:
        j = com.nnee.p_pr.cls_v.a().e(s1, s2, b.a);
          goto _L7
_L4:
        j = com.nnee.p_pr.cls_v.a().a(s1);
          goto _L7
_L2:
        j = com.nnee.p_pr.cls_v.a().a(u1);
          goto _L7
        j = com.nnee.p_pr.cls_v.a().b(u1);
          goto _L7
    }

    private void a(Intent intent)
    {
        if("android.intent.action.SEARCH".equals(intent.getAction()))
        {
            String s1 = intent.getStringExtra("query");
            l = intent.getStringExtra("extra_link");
            a(s1);
            A.setText(s1);
            AutoCompleteTextView autocompletetextview = A;
            int i1;
            if(s1 == null)
                i1 = 0;
            else
                i1 = s1.length();
            autocompletetextview.setSelection(i1);
        }
    }

    static void a(SearchActivity searchactivity, int i1, cls_u u1, String s1, String s2)
    {
        searchactivity.a(i1, u1, s1, s2);
    }

    static void a(SearchActivity searchactivity, cls_d d1, boolean flag)
    {
        searchactivity.a(d1, flag);
    }

    static void a(SearchActivity searchactivity, String s1)
    {
        searchactivity.a(s1);
    }

    static void a(SearchActivity searchactivity, boolean flag)
    {
        searchactivity.b(flag);
    }

    private void a(cls_d d1, boolean flag)
    {
        if(d1 != null && d1.h != null && u != null && (u instanceof cls_ad))
            if(flag)
            {
                ((ad)u).a(d1.h);
            } else
            {
                ((ad)u).c();
                ((ad)u).a();
                ((ad)u).b(d1.h);
            }
    }

    private void a(String s1)
    {
        m = s1;
        (new SearchRecentSuggestions(this, "com.nnee.p_pr.p_prov.SearchSuggestionProvider", 1)).saveRecentQuery(s1, null);
        if(s1 != null && s1.length() > 200)
            s1 = s1.substring(0, 200);
        a(1100, null, l, s1);
        c_();
    }

    static AutoCompleteTextView b(SearchActivity searchactivity)
    {
        return searchactivity.A;
    }

    static String b(SearchActivity searchactivity, String s1)
    {
        searchactivity.n = s1;
        return s1;
    }

    private void b(boolean flag)
    {
        if(x != null && y != null && z != null)
            if(flag)
            {
                x.setVisibility(0);
                y.setVisibility(0);
                z.setText(0x7f0a009d);
            } else
            {
                x.setVisibility(8);
            }
    }

    static boolean b(SearchActivity searchactivity, boolean flag)
    {
        searchactivity.h = flag;
        return flag;
    }

    static InputMethodManager c(SearchActivity searchactivity)
    {
        return searchactivity.D;
    }

    static String c(SearchActivity searchactivity, String s1)
    {
        searchactivity.i = s1;
        return s1;
    }

    private void c()
    {
        t = (ImageView)findViewById(0x7f0d0008);
        r = (TextView)findViewById(0x7f0d006c);
        s = (ListView)findViewById(0x7f0d00c5);
        v = (ProgressBar)findViewById(0x7f0d000c);
        w = LayoutInflater.from(this).inflate(0x7f030008, null);
        s.setDivider(null);
        s.setDividerHeight(0);
        s.addFooterView(w);
        x = (LinearLayout)w.findViewById(0x7f0d001a);
        y = (ProgressBar)w.findViewById(0x7f0d001b);
        z = (TextView)w.findViewById(0x7f0d001c);
        A = (AutoCompleteTextView)findViewById(0x7f0d0072);
        B = (ImageView)findViewById(0x7f0d0073);
        C = (ImageView)findViewById(0x7f0d0074);
    }

    static BaseAdapter d(SearchActivity searchactivity)
    {
        return searchactivity.u;
    }

    static Context e(SearchActivity searchactivity)
    {
        return searchactivity.q;
    }

    private void e()
    {
        String as[] = new String[7];
        as[0] = "icon";
        as[1] = "mark";
        as[2] = "title";
        as[3] = "content";
        as[4] = "ratingbar";
        as[5] = "button";
        as[6] = "subs";
        int ai[] = new int[7];
        ai[0] = 0x7f0d0024;
        ai[1] = 0x7f0d007a;
        ai[2] = 0x7f0d0018;
        ai[3] = 0x7f0d007d;
        ai[4] = 0x7f0d0097;
        ai[5] = 0x7f0d007e;
        ai[6] = 0x7f0d0099;
        cls_ad ad1 = new cls_ad(this, 2, 0x7f03002f, as, ai);
        if(ad1 != null)
        {
            if(s != null)
                s.setAdapter(ad1);
            ad1.e(k);
            u = ad1;
        }
    }

    static String f(SearchActivity searchactivity)
    {
        return searchactivity.n;
    }

    private void f()
    {
        if(t != null)
            t.setOnClickListener(e);
        if(s != null)
        {
            s.setOnItemClickListener(F);
            s.setOnScrollListener(f);
        }
        if(u != null)
            ((ad)u).a(e);
        A.addTextChangedListener(E);
        A.setHint(0x7f0a0079);
        B.setOnClickListener(e);
        C.setOnClickListener(e);
        C.setClickable(false);
        C.setEnabled(false);
    }

    static Stack g(SearchActivity searchactivity)
    {
        return searchactivity.o;
    }

    private void g()
    {
        if(i != null)
        {
            h = true;
            a(1105, null, i, m);
            s.addFooterView(w);
            c_();
            b(true);
        }
    }

    static boolean h(SearchActivity searchactivity)
    {
        return searchactivity.h;
    }

    static void i(SearchActivity searchactivity)
    {
        searchactivity.g();
    }

    static LinkedList j(SearchActivity searchactivity)
    {
        return searchactivity.p;
    }

    static ListView k(SearchActivity searchactivity)
    {
        return searchactivity.s;
    }

    static View l(SearchActivity searchactivity)
    {
        return searchactivity.w;
    }

    static String m(SearchActivity searchactivity)
    {
        return searchactivity.m;
    }

    static TextView n(SearchActivity searchactivity)
    {
        return searchactivity.r;
    }

    static String o(SearchActivity searchactivity)
    {
        return searchactivity.i;
    }

    public void b()
    {
        t.setVisibility(0);
        v.setVisibility(8);
    }

    public void c_()
    {
        t.setVisibility(8);
        v.setVisibility(0);
    }

    public void finish()
    {
        Intent intent = new Intent();
        Bundle bundle = new Bundle();
        bundle.putString("extra_query", A.getText().toString());
        intent.putExtras(bundle);
        setResult(-1, intent);
        super.finish();
    }

    public void onCreate(Bundle bundle)
    {
        super.onCreate(bundle);
        setContentView(0x7f03003c);
        n = null;
        q = this;
        D = (InputMethodManager)getSystemService("input_method");
        com.nnee.p_pr.cls_v.a().a(g);
        o = new Stack();
        p = new LinkedList();
        c();
        e();
        f();
        setTitle(0x7f0a0074);
        a(getIntent());
        k = com.nnee.p_b.p_a.cls_d.f();
    }

    public boolean onCreateOptionsMenu(Menu menu)
    {
        return true;
    }

    public void onDestroy()
    {
        super.onDestroy();
        com.nnee.p_pr.cls_v.a().b(g);
        com.nnee.p_img.cls_d.a().a(k);
        if(v != null)
            v.setVisibility(8);
        if(y != null)
            y.setVisibility(8);
        if(o != null)
            o.clear();
        if(p != null)
            p.clear();
        if(u != null)
        {
            ((ad)u).b();
            u = null;
        }
        if(e != null)
            e = null;
        if(f != null)
            f = null;
        if(F != null)
            F = null;
        if(s != null)
            s = null;
        i = null;
        m = null;
        n = null;
        r = null;
        t = null;
        v = null;
        w = null;
        x = null;
        y = null;
        z = null;
        q = null;
    }

    public boolean onKeyDown(int i1, KeyEvent keyevent)
    {
        boolean flag;
        if(4 != i1 || o.empty())
        {
            flag = super.onKeyDown(i1, keyevent);
        } else
        {
            String s1 = (String)o.pop();
            if(s1 != null)
                a(304, null, s1, null);
            n = s1;
            flag = true;
        }
        return flag;
    }

    protected void onNewIntent(Intent intent)
    {
        setIntent(intent);
        a(intent);
    }

    public boolean onPrepareOptionsMenu(Menu menu)
    {
        return true;
    }

    public static final int a = 0;
    public static final int b = 1;
    public static final String c = "extra_query";
    public static final String d = "extra_link";
    private AutoCompleteTextView A;
    private ImageView B;
    private ImageView C;
    private InputMethodManager D;
    private TextWatcher E;
    private android.widget.AdapterView.OnItemClickListener F;
    android.view.View.OnClickListener e;
    android.widget.AbsListView.OnScrollListener f;
    com.nnee.p_pr.cls_b g;
    private boolean h;
    private String i;
    private int j;
    private int k;
    private String l;
    private String m;
    private String n;
    private Stack o;
    private LinkedList p;
    private Context q;
    private TextView r;
    private ListView s;
    private ImageView t;
    private BaseAdapter u;
    private ProgressBar v;
    private View w;
    private LinearLayout x;
    private ProgressBar y;
    private TextView z;
}
